package cn.gson.springboot.model.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.alibaba.fastjson.JSONArray;

import cn.gson.springboot.model.pojos.Bed;
import cn.gson.springboot.model.pojos.InhospitalReg;

public interface BedDao extends CrudRepository<Bed, Integer>{

	//根据床位的状态查询初始化床位号的下拉列表
	@Query("SELECT b FROM Bed b where b.bedState=0")
	public List<Bed> findBystatus();

	//根据住院和床位表联合查询
	@Query("SELECT b FROM Bed b join b.inhospitalReg i join b.sickRoom s where i.hospId=?1")
	public Bed findBedidByhospid(String hospid);
}
